package com.mingtu.jgspatrol.adapter;


import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.StringUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mingtu.jgspatrol.R;
import com.mingtu.jgspatrol.bean.TaskListBean;


/**
 * 描述：
 * 修改人：
 * 修改时间：
 * 修改备注：
 *
 * @author wkk
 */

public class SendTaskAdapter extends BaseQuickAdapter<TaskListBean.PageBean.ListBean, BaseViewHolder> {
    private Context context;
    private boolean isFinish = false;

    public SendTaskAdapter(Context context, boolean isFinish) {
        super(R.layout.item_send_task);
        this.context = context;
        this.isFinish = isFinish;
    }

    protected void convert(@NonNull BaseViewHolder helper, TaskListBean.PageBean.ListBean listBean) {

        String taskName = listBean.getName();
        String creatTime = listBean.getCreateTime();

        if (!StringUtils.isEmpty(taskName)) {
            helper.setText(R.id.tv_title, taskName);
            helper.setText(R.id.tv_time, "任务时间：" + creatTime + "");
        }

        ImageView ivImg = helper.getView(R.id.iv_img);
        if (isFinish) {
            ivImg.setBackground(context.getDrawable(R.mipmap.icon_task2_finish));
        } else {
            ivImg.setBackground(context.getDrawable(R.mipmap.icon_task2));
        }
    }
}
